<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2017/3/9
 * Time: 13:37
 */

namespace app\admin\validate;


use think\Validate;

class Active extends Validate
{
    protected $rule =   [
        'name'              =>  'require',
        'begin_at'          =>  'require',
        'end_at'            =>  'require',
        'limit'             =>  'require',
        'template'          =>   'require',
        'share_info_title'  =>  'require',
        'share_info_intro'  =>  'require',
        'share_info_img'    =>  'require',
        'act_field'         =>  'require',
        'weight_wx'         =>  'number|>=:1',
        'weight_yqsbz'        =>  'number|>=:1',
    ];

    protected $message  =   [
        'name.require'              => '活动名称必填',
        'begin_at.require'          => '活动开始时间必填',
        'end_at.require'            => '活动结束时间必填',
        'limit.require'             => '投票限制必选',
        'template.require'          => '模板名称必填',
        'share_info_title.require'  => '分享标题必填',
        'share_info_intro.require'  => '分享描述必填',
        'share_info_img.require'    => '分享图片必传',
        'act_field.require'         => '活动需要信息必填',
        'weight_wx.number'          => '微信权重比例须是数字',
        'weight_yqsbz.number'         => '权重比例须是数字',
        'weight_wx.egt'             => '微信权重比例不能为负数',
        'weight_yqsbz.egt'            => '权重比例不能为负数',
    ];
}